//
//  JWAddressBookContactsCell.m
//  jinwang
//
//  Created by jzb on 2018/3/28.
//  Copyright © 2018年 jzb. All rights reserved.
//

#import "JWAddressBookContactsCell.h"

@implementation JWAddressBookContactsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.contentView.width = kScreenWidth;
}
- (void)setModel:(JWAddressBookContactsModel *)model{
    _model = model;
    
    
    self.user_truename.text = [NSString stringWithFormat:@"%@",model.user_truename];
    [self.HeaderImg sd_setImageWithURL:[NSURL URLWithString:model.user_portrait] placeholderImage:[UIImage imageNamed:@"headerImage"]];
    if ([_CellType isEqualToString:@"NewFriends"]) {
//        0 待审核 1已接受 2 已拒绝
        
        self.AddBtn.hidden = NO;
        if ([model.status integerValue] == 0) {
            
            self.AddBtn.userInteractionEnabled=NO;
            [self.AddBtn setTitle:@"待审核" forState:UIControlStateNormal];
            self.AddBtn.backgroundColor = [UIColor clearColor];
            [self.AddBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
        }else if ([model.status integerValue] == 1) {
            
            self.AddBtn.userInteractionEnabled=NO;
            [self.AddBtn setTitle:@"已接受" forState:UIControlStateNormal];
            self.AddBtn.backgroundColor = [UIColor clearColor];
            [self.AddBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
        }else if ([model.status integerValue] == 2) {
            
            self.AddBtn.userInteractionEnabled=NO;
            [self.AddBtn setTitle:@"已拒绝" forState:UIControlStateNormal];
            self.AddBtn.backgroundColor = [UIColor clearColor];
            [self.AddBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
        }else{
            self.AddBtn.userInteractionEnabled=YES;
            [self.AddBtn setTitle:@"接受" forState:UIControlStateNormal];
            self.AddBtn.backgroundColor = UIColorHex(0xEEA72B);
            [self.AddBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        }
        
    }else{
        
        self.AddBtn.hidden = YES;
    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
